<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
    <meta charset="UTF-8">
    <%@include file="style.jsp" %>
    <%@include file="script.jsp" %>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/orderlang/distributor/css/product_activity.css"/>
    <title>商品活动</title>
</head>
<body onselectstart="return false">
<div id="container_1" style="height:100%">
    <div style="position: relative">
        <%@include file="header.jsp" %>
    </div>
    <div id="content" class="clearfix">
        <%@include file="left_menu.jsp" %>
        <!--内容部分-->
        <div class="right-content" style="margin:75px 20px 0 213px;">
            <p class="brand">
                <a>商品</a>><a class="now">商品促销</a>
            </p>
            <div class="content">
                <div class="top-block">
                    <div class="delete-more fr">批量删除</div>
                    <a href="${pageContext.request.contextPath}/productActivity/insert" ><div class="new-product fr">新增活动</div></a>
                    <div class="state">
                        <ul class="clearfix">
                            <!-- <li class="active">全部状态</li>
                            <li>未开始</li>
                            <li>进行中</li>
                            <li>已结束</li> -->
                        </ul>
                    </div>
                </div>
                <div class="product-list">
                    <table>
                        <thead>
                            <tr>
                                <td><s></s></td>
                                <td>活动标题</td>
                                <td>开始时间/结束时间</td>
                                <td>客户类型</td>
                                <td>客户地区</td>
                                <td>创建时间</td>
                                <td></td>
                            </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${allProductActivity }" var="activity" varStatus="i">
                        <tr>
                            <td><s></s></td>
                            <td>
                                <div>
                                    <p>${activity.title}</p>
                                    <c:set var="nowDate" value="${today }"></c:set>
									<c:choose>
										<c:when test="${nowDate<=activity.startTime }">
										<p class="product-state noStart">未开始</p>
										</c:when>
										<c:when test="${nowDate>=activity.endTime }">
										<p class="product-state over">已结束</p>
										</c:when>
										<c:otherwise>
										<p class="product-state starting">进行中</p>
										</c:otherwise>
									</c:choose>
                                </div>

                            </td>
                            <td><fmt:formatDate value="${activity.startTime}"  pattern="yyyy.MM.dd"/>-<fmt:formatDate value="${activity.endTime}"  pattern="yyyy.MM.dd"/></td>
                            <td>一级代理商</td>
                            <c:forEach items="${cityList }" var="citys" begin="${i.index }" end="${i.index }">
                            	<td>${citys.provinces.name }${citys.name }</td>
                            </c:forEach>
                            <td><fmt:formatDate value="${activity.createTime}"  pattern="yyyy.MM.dd"/></td>
                            <td>
                                <button class="detail" onclick="activityDetail(${activity.id})" >详情</button>
                                <button class="revise" onclick="updateActivity(${activity.id})" >修改</button>
                                <%-- <button class="delete" onclick="deleteActivity(${activity.id},this)" >删除</button> --%>
                            </td>
                        </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <!-- -----分页----- -->
                    <div class="quotes" style="margin-top: 50px"></div>
                </div>
            </div>
        </div>
        <script src="${pageContext.request.contextPath}/static/orderlang/distributor/js/product_activity.js"></script>
        <!--内容部分结束-->
    </div>
</div>

</body>
</html>